'use strict';
var calculate_average = function(collection){
    let arr = [];
    for(let item of collection){
        if(item%2 === 0){
            arr.push(item);
        console.log(arr);
        }
    }
    let sum = arr.reduce(function(prevision,current){
        return prevision+current;
    })
    let result = sum/arr.length;
    console.log(result);
    return result;
    };
    calculate_average([1,2,3,4,5,6]);
    module.exports = calculate_average;
    